<%@ page language="java" pageEncoding="utf-8"%>
<%
	String ct = request.getContextPath();
%>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport"
	content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="apple-touch-icon-precomposed" href="images/todolist.png" />
<link rel="apple-touch-startup-image" href="images/todo-splash.png" />
<title>销售日报</title>
<link rel="stylesheet" type="text/css" href="<%=ct%>/css/tablet.css">
<link type="text/css" href="<%=ct%>/css/demo.css" rel="stylesheet">

<script type="text/javascript"
	src="<%=ct%>/dojo/dojox/mobile/deviceTheme.js"
	data-dojo-config="mblThemeFiles:['@theme',['demos/todoApp','todo']]"></script>

<script type="text/javascript" src="<%=ct%>/dojo/dojo/dojo.js"
	data-dojo-config="parseOnLoad: true,
				mblHideAddressBar: false,
				mblAndroidWorkaround: false,
				mblAlwaysHideAddressBar: false,
				app: {debugApp: 0},  // set debugApp to log app transtions and view activate/deactivate
				mvc: {debugBindings: 0},  // set on to debug mvc data bindings
				async: 1">
		</script>
<title>薪酬通-薪资查询</title>
<script language="JavaScript" type="text/javascript">
		require([
           "dojo/dom",
           "dojo/on",
     	   "dojo/_base/array",
    	   "dojo/ready",
    	   "dijit/registry",
    	   "dojox/mobile/ListItem",
    	   "dojox/mobile/parser",
    	   "dojox/mobile/Button",
			"dijit/_base/manager",  // dijit.byId
			"dojox/mobile",
			"dojox/mobile/compat",
			"dojox/mobile/parser",
			"dojox/mobile/Opener",
			"dojox/mobile/SpinWheelDatePicker"
		],function(dom,on, arr, ready, registry, ListItem){
			 ready(function() {
				 var myButton = dom.byId("searchbutton");
				 on(myButton, "click", function(evt){
					  registry.byId("home").performTransition("searchview", 1, "slide");
				  });
				 var params = {
						 operation:"listSupplierCertificate"
						};

					dojo.xhrGet({
				               url:'<%=ct%>/listSupplierCertificateAction.do',
				               content:params,
				               handleAs: "json",
				               load: resultCallback,
				               error: resultError
				                });
					});
		function resultCallback(data,ioArgs) {
			var salarylist = registry.byId("neworderlist");
			arr.forEach(salarylist.getChildren(), function(child){
				salarylist.removeChild(child);
			});
			arr.forEach(data, function(item, i){
				var li = new ListItem({
					onClick: getdetail,
					moveTo: "orderDetail",
				//	rightText:item.salaryMonth,
					icon:'img/tab-icon-11h.png',
					item:item

				});
				li.labelNode.innerHTML = item.certificate_name;
				salarylist.addChild(li);
			});
		}

		function getdetail(item){
			var detail = registry.byId("detail");
			// remove anything from previous selected stock
			arr.forEach(detail.getChildren(), function(child){
				detail.removeChild(child);
			});
			orderno=this.item.suppliercode;
			var li9 = new ListItem({
				rightText:this.item.suppliercode,

			});
			li9.labelNode.innerHTML = "证照编号：";
			detail.addChild(li9);
			var li = new ListItem({
				rightText:this.item.suppliername ,

			});
			li.labelNode.innerHTML = "供应商编码 ：";
			detail.addChild(li);

			var li1 = new ListItem({
				rightText:this.item.certificate_type ,

			});
			li1.labelNode.innerHTML = "证照类型：";
			detail.addChild(li1);

			var li2 = new ListItem({
				rightText:this.item.certificate_name ,

			});
			li2.labelNode.innerHTML = "证照类型名称：";
			detail.addChild(li2);

			var li6 = new ListItem({
				rightText:this.item.url ,

			});
			li6.labelNode.innerHTML = "存储地址：";
			detail.addChild(li6);

			var li7 = new ListItem({
				rightText:this.item.enddate!=null?this.item.enddate.substr(0,10):"",

			});
			li7.labelNode.innerHTML = "有效期：";
			detail.addChild(li7);
			var li20 = new ListItem({
				rightText:this.item.recorddate!=null?this.item.recorddate.substr(0,10):"",

			});
			
			li20.labelNode.innerHTML = "上传日期：";
			detail.addChild(li20);
	
		}
		    //错误提示
		       function resultError(data, ioArgs) {
		            var Node=document.getElementById("neworderlist");
		             var listItem=document.createElement("li");
				     listItem.innerHTML=("网络异常!请重新操作!"); //使用占位符
				     Node.appendChild(listItem);
		       }

				function resultCalldetail(data,ioArgs) {
					var detail = registry.byId("ordersdetail");
					// remove anything from previous selected stock
					arr.forEach(detail.getChildren(), function(child){
						detail.removeChild(child);
					});
					arr.forEach(data, function(item){
						var li = new ListItem({
							onClick: getdetail,
							moveTo: "orderDetail",
							rightText:item.inmoney,
							icon:'img/tab-icon-11h.png',
							item:item

						});
						li.labelNode.innerHTML = item.gdsname;
						detail.addChild(li);
					});
		   	}
	});

		function getDate(node, v){
			if(v === true){ // Done clicked
				node.value = dijit.byId("spin1").get("values").join('-');
			}
		}
		function setDate(node){
			var v = node.value.split(/-/);
			if(v.length == 3){
				var w = dijit.byId("spin1");
				w.set("values", v);
			}
		}
		
		require([
		         "dijit/registry",
		         "dojo/_base/array",
		         "dojox/mobile/ViewController",
		         "dojox/mobile/ListItem",
		         "dojox/mobile/parser",
		         "dojox/mobile",
		         "dojox/mobile/Button",
		         "dojox/mobile/ExpandingTextArea"
		     ], function(registry,arr, ViewController,ListItem){
				 onBtn2Clicked=function(e){
					 registry.byId("searchview").performTransition("home", 1, "slide");
				 }
			});
	</script>
</head>
<body>
	<div id="home" data-dojo-type="dojox.mobile.View"
		data-dojo-props="selected: true">
		<h1 data-dojo-type="dojox.mobile.Heading" label="证照列表">
					<span data-dojo-type="dojox.mobile.ToolBarButton"
				data-dojo-props='icon:"mblDomButtonWhiteSearch"'
				style="float: right;" id="searchbutton"></span>
		</h1>
		<ul data-dojo-type="dojox.mobile.RoundRectList" id="neworderlist">
		</ul>
	</div>

	<div id="orderDetail" data-dojo-type="dojox.mobile.View">
		<h1 data-dojo-type="dojox.mobile.Heading"
			data-dojo-props="back:'证照列表', moveTo:'home'">证照明细</h1>
		<ul data-dojo-type="dojox.mobile.RoundRectList" id="detail">
		</ul>
	</div>

	<div id="searchview" data-dojo-type="dojox.mobile.View"
		data-dojo-props="selected: true">
		<h1 data-dojo-type="dojox.mobile.Heading"
			data-dojo-props="back:'证照列表', moveTo:'home'">证照查询</h1>
		<div>

			<div class="itemcellwrapper">
					<label class="mblLabel">公告名称:</label>
					<input id="detail_todo"  class="mblTextArea mblExpandingTextArea itemcell" placeholder="Title" tabindex="0" widgetid="detail_todo" value="" ></textarea> 
					<input id="detail_todo1"  class="mblTextArea mblExpandingTextArea itemcell" placeholder="Title" tabindex="0" widgetid="detail_todo" value="订货时间" readOnly onclick="dijit.byId('datePicker').show(this, ['above-centered','below-centered','after','before'])"></textarea>
					<button id="deleteCurrentItem"  data-dojo-type="dojox/mobile/Button" class="mblButton baseBtn mblRedButton itemcell" tabindex="0" widgetid="deleteCurrentItem" style="-webkit-user-select: none;" data-dojo-props='onClick:onBtn2Clicked' >查询</button> 
			</div>

			<div id="datePicker" data-dojo-type="dojox.mobile.Opener"
				data-dojo-props="onHide:getDate, onShow:setDate">
				<h1 dojoType="dojox.mobile.Heading" label="Date Picker">
					<span dojoType="dojox.mobile.ToolBarButton" label="Done"
						class="mblColorBlue"
						style="position: absolute; width: 45px; right: 0;"
						onclick="dijit.byId('datePicker').hide(true)"></span> <span
						dojoType="dojox.mobile.ToolBarButton" label="Cancel"
						class="mblColorBlue"
						style="position: absolute; width: 45px; left: 0;"
						onclick="dijit.byId('datePicker').hide(false)"></span>
				</h1>
				<div id="spin1" data-dojo-type="dojox/mobile/SpinWheelDatePicker"></div>
			</div>

		</div>
	</div>
</body>
</html>